package com.zj.small.mapper;

import com.zj.small.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    @Select("SELECT * FROM user WHERE username = #{username}")
    User findByUsername(String username);
    @Insert("INSERT INTO user (username, password) VALUES (#{username}, #{password})")
    void add(String username, String password);

    @Select("SELECT * FROM user WHERE email = #{email}")
    User findByUserEmail(String email);

    @Insert("INSERT INTO user (username, password, email, create_time, update_time) VALUES (#{username}, #{password}, #{email}, now(), now())")
    void addUser(String username, String password, String email);
    // 查询用户名和密码
}
